package data;

import java.math.BigDecimal;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class DealQueue {
	public String code;
	private BigDecimal averyAmount; 
	private BlockingQueue<DealPiece> dealPieceQ= new ArrayBlockingQueue<DealPiece>(15);

	public DealQueue(String code){
		this.code = code;
	}

	public BlockingQueue<DealPiece> getDealPieceQ() {
		return dealPieceQ;
	}
	
	public void setDealPieceQ(BlockingQueue<DealPiece> dealPieceQ) {
		this.dealPieceQ = dealPieceQ;
	}
	
	public BigDecimal getAveryAmount() {
		return averyAmount;
	}
	
	public void setAveryAmount(BigDecimal averyAmount) {
		this.averyAmount = averyAmount;
	}
	
	public void put(TimeStock ts){
		if(dealPieceQ.size()>=15){
			dealPieceQ.poll();
		}
		DealPiece dp = new DealPiece();
		dp.setAmount(ts.getAmount());
		dp.setPrice(ts.getCurPrice());
	}
}
